//
//  SelectionCell.m
//  礼物
//
//  Created by dllo on 15/11/6.
//  Copyright © 2015年 liangsicheng. All rights reserved.
//

#import "SelectionCell.h"
#import "Model.h"
@implementation SelectionCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
    }
    return self;
}
-(void)createSubViews
{
    self.lineLabel=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, WIDTH, 4)];
    self.lineLabel.backgroundColor=[UIColor whiteColor];
    [self.contentView addSubview:self.lineLabel];
    self.cover_image_urlView=[[UIImageView alloc]initWithFrame:CGRectMake(0, 4, WIDTH, 146*HEIGHT/667)];
    [self.contentView addSubview:self.cover_image_urlView];
    self.bigLabel=[[UILabel alloc]initWithFrame:CGRectMake(WIDTH-70*WIDTH/375-5, 5, 70*WIDTH/375, 25*HEIGHT/667)];
    self.bigLabel.backgroundColor=[UIColor blackColor];
    self.bigLabel.layer.masksToBounds=YES;
    self.bigLabel.layer.cornerRadius=self.bigLabel.frame.size.width/6;
    self.bigLabel.alpha=0.4;
    [self.contentView addSubview:self.bigLabel];
    self.heartImageView=[[UIImageView alloc]initWithFrame:CGRectMake(self.bigLabel.frame.origin.x+10, self.bigLabel.frame.origin.y+2, 20*WIDTH/375, 20*HEIGHT/667)];
    [self.contentView addSubview:self.heartImageView];
    self.heartImageView.image=[UIImage imageNamed:@"iconfont-xin.png"];
    self.smallLabel=[[UILabel alloc]initWithFrame:CGRectMake(self.heartImageView.frame.origin.x+self.heartImageView.frame.size.width, self.heartImageView.frame.origin.y+6, 40*WIDTH/375, 10*HEIGHT/667)];
    self.smallLabel.font=[UIFont boldSystemFontOfSize:10];
    self.smallLabel.textColor=[UIColor whiteColor];
    [self.contentView addSubview:self.smallLabel];
    self.titleLabel=[[UILabel alloc]initWithFrame:CGRectMake(0, (150-30)*WIDTH/375, WIDTH, 30*HEIGHT/667)];
    self.titleLabel.backgroundColor=[UIColor colorWithPatternImage:[UIImage imageNamed:@"background.png"]];
    self.titleLabel.textColor=[UIColor whiteColor];
    [self.contentView addSubview:self.titleLabel];
}
-(void)setModel:(Model *)model
{
    _model=model;
    self.titleLabel.text=[NSString stringWithFormat:@"   %@", _model.title];
    self.smallLabel.text=[NSString stringWithFormat:@"%ld",_model.likes_count];
    [self.cover_image_urlView sd_setImageWithURL:[NSURL URLWithString:_model.cover_image_url]];
}



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
